﻿using Architecture.Domain.Service;
using Architecture.Repository.Interface;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Healthinfo;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Healthinfo
{
    public class HealthUpdateCommandHandler : IRequestHandler<HealthUpdateCommand, int>
    {
        protected readonly IHealthCareService service;

        public HealthUpdateCommandHandler(IHealthCareService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(HealthUpdateCommand request, CancellationToken cancellationToken)
        {
            return await service.HealthUpd(new HealthCare() { DaysofFeeding = request.DaysofFeeding, GoodsInfoid = request.GoodsInfoid, HealthCareid = request.HealthCareid, HealthCareMode = request.HealthCareMode, ModeofOperation = request.HealthCareMode });
        }
    }
}
